package com.dashou.controller;


import com.dashou.entity.Admin;
import com.dashou.entity.Result;
import com.dashou.service.AdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Resource
    private AdminService adminService;

    @PostMapping("/login")
    public Result AdminLogin(@RequestBody Admin loginAdmin) {
        if (adminService.adminLoginServer(loginAdmin)!=null) {
            return new Result(200, "登录成功！", null);
        } else {
            return new Result(400, "用户名或密码错误！", null);
        }
    }
}
